import { createRouter, createWebHistory } from 'vue-router'

//import HomeView from '../views/HomeView.vue'
import Main from '../views/Main.vue'
import UserMain from '../views/UserMain.vue'
import ServePersonList from '../views/ServePersonList.vue'
import OpeNoticeList from '../views/OpeNoticeList.vue'
import OpeNoticeAdd from '../views/OpeNoticeAdd.vue'
import OpeNoticeModify from '../views/OpeNoticeModify.vue'
import OpeLikeComment from '../views/OpeLikeComment.vue'
import OpeNoticeDetail from '../views/OpeNoticeDetail.vue'
import OpeNoticeData from '../views/OpeNoticeData.vue'
import ServeAuditList from '../views/ServeAuditList.vue'
import ServeWorkOrderList from '../views/ServeWorkOrderList.vue'
import LoginView from '../views/LoginView.vue'
import AdmLoginView from '../views/AdmLoginView.vue'
import AccountView from '../views/AccountView.vue'
import UserView from '../views/UserView.vue'
import Wares from '../views/Wares.vue'
import ServeWorkOrderParticulars from '../views/ServeWorkOrderParticulars.vue'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    //配置默认路由
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/login',
      name: 'login',
      component: LoginView
    },
    {
      path: '/admlogin',
      name: 'admlogin',
      component: AdmLoginView
    },
    {
      path: '/main',
      name: 'main',
      component: Main,
      //配置嵌套路由
      children: [
        //========服务模块路由==========
        {
          path: '/serveWorkOrderParticulars/:wid',
          name: 'serveWorkOrderParticulars',
          component: ServeWorkOrderParticulars
        },
        {
          path: '/servePersonList',
          name: 'servePersonList',
          component: ServePersonList
        },
        //======运营管理 start======
        {
          path: '/opeNoticeList',
          name: 'opeNoticeList',
          component: OpeNoticeList
        },
        {
          path: '/opeNoticeAdd',
          name: 'opeNoticeAdd',
          component: OpeNoticeAdd
        },
        {
          path: '/opeNoticeModify/:nid',
          name: 'opeNoticeModify',
          component: OpeNoticeModify,
        },
        {
          path: '/opeLikeComment',
          name: 'opeLikeComment',
          component: OpeLikeComment
        },
        {
          path: '/opeNoticeDetail/:nid',
          name: 'opeNoticeDetail',
          component: OpeNoticeDetail,
        },
        {
          path: '/opeNoticeData',
          name: 'opeNoticeData',
          component: OpeNoticeData,
        },
        //======运营管理 end======
        {
          path: '/serveAuditList',
          name: 'serveAuditList',
          component: ServeAuditList
        },
        {
          path: '/serveWorkOrderList',
          name: 'serveWorkOrderList',
          component: ServeWorkOrderList
        },
        //========做为商品模块路由==========
        {
          path: '/wares',
          name: 'wares',
          component: Wares
        },
        //========wares END !==============

//========账户信息模块 !==============
        {
          path: '/account',
          name: 'account',
          component: AccountView
        },
//========客户信息模块 !==============
        {
          path: '/user',
          name: 'user',
          component: UserView
        },
//========wares END !==============
      ]
    },
    {
      path: '/usermain',
      name: 'usermain',
      component: UserMain,
      //配置嵌套路由
      children: [
        {
          path: '/servePersonList',
          name: 'servePersonList',
          component: ServePersonList
        },
//========做为商品模块路由==========
        {
          path: '/wares',
          name: 'wares',
          component: Wares
        },
//========账户信息模块 !==============
        {
          path: '/account',
          name: 'account',
          component: AccountView
        },
//========客户信息模块 !==============
        {
          path: '/user',
          name: 'user',
          component: UserView
        },
//========wares END !==============
      ]
    },
    {
      // path: '/about',
      // name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.

      //component: () => import('../views/AboutView.vue')

    }
  ]
})

export default router
